package gazzera.node.core;

import java.util.regex.*;

public class RegExp
{
	private static final Pattern p = Pattern.compile("^(.+)\\@([abcdefABCDEF1234567890]{40})(@(.+):([0123456789]+))?$");
	
	public static boolean match(String s)
	{
		return p.matcher(s).matches();
	}
	
	
	public static String[] group(String s)
	{
		Matcher m = p.matcher(s);
		if (!m.matches())
		{
			return null;
		}
		String[] r = new String[m.groupCount()+1]; 
		for (int i = 0; i < r.length; i++)
		{
			r[i] = m.group(i);
		}
		return r;
	}
}
